package org.nf.order.service.impl;

import org.nf.order.dao.OrderDao;
import org.nf.order.dao.impl.OrderDaoImpl;
import org.nf.order.model.Order;
import org.nf.order.service.OrderService;
import org.nf.order.util.PageUtils;
import org.nf.order.vo.PageVO;

import java.util.List;


public class OrderServiceImpl implements OrderService {
    private OrderDao dao = new OrderDaoImpl();



    @Override
    public int insert(Order order) {
        return dao.insertOrder(order);
    }

    @Override
    public PageVO<List<Order>> listOrder(int page, int limit) {
        int numberOf = PageUtils.toNumberOf(page,limit);
        OrderDao dao = new OrderDaoImpl();
        List<Order> list = dao.listOrder(numberOf,limit);

        long count = dao.orderCount();

        return PageUtils.toPageVO(list,count);
    }
}
